package org.han.util;

import java.util.List;

import org.hibernate.Hibernate;


import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;

public class JsonUtil {
	public static String getStrByList(List obj) {
		JSONArray jsonArray = JSONArray.fromObject(obj);
		return jsonArray.toString();
	}

	public static String getStrByObject(Object obj) {
		JsonConfig jsonConfig=new JsonConfig();   
		jsonConfig.setExcludes(new String[]{"handler","hibernateLazyInitializer"});   
		    
		JSONObject.fromObject(Hibernate.DATE,jsonConfig); 

		JSONObject json=JSONObject.fromObject(obj);
		return json.toString();
	}
}
